!function(a) {
    function b(a) {
        return !isNaN(parseFloat(a));
    }
    function c() {
        for (var c = 0; c < arguments.length; c++) if (b(arguments[c])) return Number(parseFloat(arguments[c]));
    }
    function d(b, c) {
        var d = a(c || this).attr("class"), e = new RegExp("(\\b" + b + ")(\\S*)").exec(d), f = {
            "true": !0,
            True: !0,
            "false": !1,
            False: !1
        };
        return e && e.length >= 3 && void 0 !== f[e[3]] && (e[3] = f[e[3]]), e ? e.length >= 3 ? e[2] : null : void 0;
    }
    a.fn.stepperComp = function(e) {
        if (e && "String" == typeof e && "destroy" === e) return this.unbind(".stepper").removeClass(e.stepperClass).removeClass(e.upClass).removeClass(e.downClass).removeClass(e.upHoverClass).removeClass(e.downHoverClass).removeData("stepperMin").removeData("stepperMax").removeData("stepperReset").removeData("stepperStep").removeData("stepperBigStep");
        var f;
        return e = a.extend({}, a.fn.stepperComp.defaults, e), this.each(function() {
            var g = a(this), h = d("stepperMin", this), i = d("stepperMax", this), j = d("stepperStep", this), k = d("stepperBigStep", this), l = d("stepperReset", this), m = 2;
            h === f && (h = c(g.attr("min"), e.min)), i === f && (i = c(g.attr("max"), e.max)), 
            j || (j = c(g.attr("step"), e.step)), k || (k = c(g.attr("bigStep"), e.bigStep)), 
            l === f && (l = c(e.reset, g.val(), h, i)), m === f && (m = g.data("stepperScale")), 
            m = m || b(m) ? m : e.scale, g.data("stepperMin", h), g.data("stepperMax", i), g.data("stepperStep", j), 
            g.data("stepperBigStep", k), g.data("stepperReset", l), g.data("stepperScale", m);
        }), this.each(function() {
            function j(d, g, h) {
                var j, k, l, m, n, i = a(this);
                e.ignore && i.is(e.ignore) || (g = c(g, i.data("stepperStep"), 1), h = h || (f ? -1 : 1), 
                j = i.val(), k = c(j, i.data("stepperReset"), 0), l = c(i.data("stepperMin")), m = c(i.data("stepperMax")), 
                n = [ k, g, l, m, h, j, e ], h > 0 ? k = e.increment.apply(this, n) : 0 > h && (k = e.decrement.apply(this, n)), 
                b(i.data("stepperScale")) && e.round && (k = e.round(k, i.data("stepperScale"))), 
                b(l) && (k = Math.max(k, l)), b(m) && (k = Math.min(k, m)), n = [ k, g, l, m, h, j, e ], 
                k != j && i.triggerHandler("beforeSpin", n) !== !1 && (i.val(k), i.trigger("change", n), 
                i.triggerHandler("spin", n)));
            }
            function k(a, b) {
                l(), g = window.setTimeout(function() {
                    j.apply(a, [ b ]), h = window.setInterval(function() {
                        j.apply(a, [ b ]);
                    }, e.repeat);
                }, e.delay);
            }
            function l() {
                window.clearTimeout(g), window.clearInterval(h);
            }
            var d, f, g, h, i = a(this);
            i.bind("mousemove.stepper", function(b) {
                var c = a(this), g = c.offset(), h = c.height() / 2, i = b.pageX > g.left + c.width() - e.buttonWidth;
                d = i && b.pageY <= g.top + h, f = i && b.pageY > g.top + h, c.toggleClass(e.upHoverClass, d).toggleClass(e.downHoverClass, f);
            }).bind("mouseout.stepper", function() {
                l(), a(this).removeClass([ e.upClass, e.downClass, e.upHoverClass, e.downHoverClass ].join(" ")), 
                d = f = null;
            }).bind("mousedown.stepper", function(b) {
                (d || f) && (a(this).toggleClass(e.upClass, d).toggleClass(e.downClass, f), j.apply(this, [ b ]), 
                k(this, b));
            }).bind("mouseup.stepper", function() {
                l(), a(this).removeClass(e.upClass).removeClass(e.downClass);
            }).bind("keydown.stepper", function(b) {
                var c, d, f, g;
                if (e.keys && !a.grep(e.keys, function(a) {
                    return a === b.keyCode || a instanceof RegExp && a.test(String.fromCharCode(b.keyCode));
                }).length) return !e.keys;
                switch (c = a(this), d = {
                    up: 38,
                    down: 40,
                    pageUp: 33,
                    pageDown: 34
                }, f = c.data("stepperBigStep"), g = b.shiftKey ? f : c.data("stepperStep"), b.keyCode) {
                  case d.up:
                    j.apply(this, [ b, g, 1 ]);
                    break;

                  case d.down:
                    j.apply(this, [ b, g, -1 ]);
                    break;

                  case d.pageUp:
                    j.apply(this, [ b, f, 1 ]);
                    break;

                  case d.pageDown:
                    j.apply(this, [ b, f, -1 ]);
                }
                return 107 == b.keyCode ? (j.apply(this, [ b, g, 1 ]), !e.keys) : 109 == b.keyCode ? (j.apply(this, [ b, g, -1 ]), 
                !e.keys) : void 0;
            }).bind("change.stepper", function(a) {
                j.apply(this, [ a, 0 ]);
            }).addClass(e.stepperClass), e.mousewheel && a(this).mousewheel(function(b, c) {
                var f = b.shiftKey ? a(this).data("stepperBigStep") : a(this).data("stepperStep");
                return c > 0 ? j.apply(this, [ b, f, 1 ]) : 0 > c && j.apply(this, [ b, f, -1 ]), 
                !1;
            }), j.apply(this, [ a.Event(), 0 ]);
        });
    }, a.fn.stepperComp.defaults = {
        min: 0,
        max: null,
        step: 1,
        bigStep: 10,
        keys: [ /[0-9]/, 9, 13, 8, 46, 33, 34, 37, 38, 39, 40, 188, 190, 96, 97, 98, 99, 100, 101, 102, 103, 104, 110, 107, 109 ],
        ignore: "[readonly],[disabled]",
        stepperClass: "stepper-active",
        upClass: "stepper-up",
        downClass: "stepper-down",
        upHoverClass: "stepper-up-hover",
        downHoverClass: "stepper-down-hover",
        mousewheel: !0,
        change: !0,
        increment: function(a, b) {
            return a + b;
        },
        decrement: function(a, b) {
            return a - b;
        },
        reset: null,
        delay: 500,
        repeat: 100,
        buttonWidth: 20,
        scale: !0,
        round: function(a, b) {
            return Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
        }
    }, a.fn.stepperRender = function() {
        var b = 0, c = null, d = 1;
        null != a(this).attr("min") && (b = parseInt(a(this).attr("min"))), null != a(this).attr("max") && (c = parseInt(a(this).attr("max"))), 
        null != a(this).attr("step") && (d = parseInt(a(this).attr("step"))), a(this).stepperComp({
            min: b,
            max: c,
            step: d
        });
    };
}(jQuery), function(a) {
    function d(b) {
        var c = b || window.event, d = [].slice.call(arguments, 1), e = 0, g = 0, h = 0;
        return b = a.event.fix(c), b.type = "mousewheel", c.wheelDelta && (e = c.wheelDelta / 120), 
        c.detail && (e = -c.detail / 3), h = e, void 0 !== c.axis && c.axis === c.HORIZONTAL_AXIS && (h = 0, 
        g = -1 * e), void 0 !== c.wheelDeltaY && (h = c.wheelDeltaY / 120), void 0 !== c.wheelDeltaX && (g = -1 * c.wheelDeltaX / 120), 
        d.unshift(b, e, g, h), (a.event.dispatch || a.event.handle).apply(this, d);
    }
    var c, b = [ "DOMMouseScroll", "mousewheel" ];
    if (a.event.fixHooks) for (c = b.length; c; ) a.event.fixHooks[b[--c]] = a.event.mouseHooks;
    a.event.special.mousewheel = {
        setup: function() {
            if (this.addEventListener) for (var a = b.length; a; ) this.addEventListener(b[--a], d, !1); else this.onmousewheel = d;
        },
        teardown: function() {
            if (this.removeEventListener) for (var a = b.length; a; ) this.removeEventListener(b[--a], d, !1); else this.onmousewheel = null;
        }
    }, a.fn.extend({
        mousewheel: function(a) {
            return a ? this.bind("mousewheel", a) : this.trigger("mousewheel");
        },
        unmousewheel: function(a) {
            return this.unbind("mousewheel", a);
        }
    });
}(jQuery);